home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / misc / vb3utils / readme.txt < prev   
Encoding:
Text File  |  1996-01-08  |  2.8 KB  |  68 lines

  1. These are just some of the routines I use ** CONSTANTLY ** in VB3.
  2. The code is FreeWare, i.e. I expect no payment, 'cos I reckon they
  3. should have been included in VB anyway.
  4.  
  5. They've been fairly well tested, but as usual, use them at your
  6. own risk.
  7.  
  8. Here's a quick description:
  9.  
  10. Sub ExitIfAlreadyRunning()
  11. This checks if the current application is already running, and switches to it
  12. if it is. It also exits the current instance in this case, and doesn't return.
  13. I usually make it the first call in Sub Main.
  14.  
  15. Function FormFloat (FloatForm As Form, Floating%) As Integer
  16. Makes a form "float" - i.e. Always on top, when Floating% = true. Switches
  17. back to normal when Floating% = false. Returns the return code from
  18. SetWindowPos().
  19.  
  20. The ProfileString functions just encapsulate the API functions. They also
  21. use App.Title if ApplicationName = "". The Get* functions also remove the
  22. trailing null chars (chr(0)) from the string.
  23.  
  24. For other data types, I convert to-from a string myself & use these.
  25.  
  26. Function GetPrivateProfileString (ByVal ApplicationName As String, KeyName As String, default As String, Size As Integer, FileName As String) As String
  27. Function GetProfileString (ByVal ApplicationName As String, KeyName As String, default As String, Size As Integer) As String
  28. Function WritePrivateProfileString (ByVal ApplicationName As String, KeyName As String, Value As String, FileName As String) As Integer
  29. Function WriteProfileString (ByVal ApplicationName As String, KeyName As String, Value As String) As Integer
  30.  
  31. The following functions Save / Restore a forms position to / from WIN.INI.
  32. The AppName parameter specifies the section - it will use App.Title if this
  33. is blank. You could also modify it to save to another INI file.
  34.  
  35. Function SaveWindowPos (AppForm As Form, AppName As String) As Integer
  36. Function RestoreWindowPos (AppForm As Form, AppName As String, Flags As Integer) As Integer
  37.  
  38. NB: The flags are defined in the [declarations] section, and allow you to
  39. "partially restore" the position. One use is to ensure that the width & height
  40. aren't restored - use WPR_LEFTTOP | WPR_STATE for this.
  41. I usually call RestoreWindowPos() after loading the form, but before I Show
  42. it, so the user doesn't see the move.
  43.  
  44. The *Sound* functions allow you to play sounds as defined in the WIN.INI
  45. [Sounds] section. Note that you are not limited to the ones already there -
  46. you can define your own, pointing to your own .WAV files.
  47. NB: PlaySound(x) is equivalent to PlaySoundExt(x, SND_ASYNC)
  48.  
  49. Function PlaySound (SoundName As String)
  50. Function PlaySoundExt (SoundName As String, Flags As Integer)
  51. Sub StopSound ()
  52.  
  53. I hope you find these as useful as I have.
  54.  
  55. ROSCO.
  56.  
  57. Contact:
  58.  
  59. Ross Crawford,
  60. 3 / 73 Ripley Road,
  61. WEST MOONAH   7009
  62. TASMANIA,
  63. AUSTRALIA
  64.  
  65. CIS: 100354,677
  66. Internet: 100354.677@compuserve.com
  67.  
  68.